package java_class.Car_class;

import java.util.Scanner;
public class Car_test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Car[] arr = new Car[3];
        for (int i = 0; i < arr.length; i++) {
            Car c = new Car();

            // 设置品牌
            System.out.println("请输入品牌：");
            String brand = sc.next();
            c.setBrand(brand);
            // 设置价格
            System.out.println("请设置价格：");
            int price = sc.nextInt();
            c.setPrice(price);
            // 设置颜色
            System.out.println("请输入颜色：");
            String color = sc.next();
            c.setColor(color);
            // 添加到数组中
            arr[i] = c;
        }

        // 打印数组
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i].getBrand() + " " + arr[i].getPrice() + " " +
                    arr[i].getColor());
        }
        sc.close();

    }
}
